<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Get all collections from this database</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mongodb.get.html">MongoDB::__get</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mongodb.getdbref.html">MongoDB::getDBRef</a></div>
 <div class="up"><a href="class.mongodb.html">MongoDB</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="mongodb.getcollectionnames" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoDB::getCollectionNames</h1>
  <p class="verinfo">(PECL mongo &gt;=1.3.0)</p><p class="refpurpose"><span class="refname">MongoDB::getCollectionNames</span> &mdash; <span class="dc-title">Get all collections from this database</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mongodb.getcollectionnames-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">array</span> <span class="methodname"><strong>MongoDB::getCollectionNames</strong></span>
    ([ <span class="methodparam"><span class="type">bool</span> <code class="parameter">$includeSystemCollections</code><span class="initializer"> = false</span></span>
  ] )</div>

  <p class="para rdfs-comment">
   Returns an array of all the collection names for the given database.
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-mongodb.getcollectionnames-parameters">
  <h3 class="title">参数</h3>
  <dl>

   
    <dt>
<em><code class="parameter">includeSystemCollections</code></em></dt>

    <dd>

     <p class="para">
      Include system collections.
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-mongodb.getcollectionnames-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns the names of the all the collections in the database as an <span class="type"><a href="language.types.array.html" class="type array">array</a></span>.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-mongodb.getcollectionnames-examples">
  <h3 class="title">范例</h3>
  <div class="example" id="example-1392">
   <p><strong>Example #1 <span class="function"><strong>MongoDB::getCollectionNames()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$m&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Mongo</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$collections&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$m</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">selectDB</span><span style="color: #007700">(</span><span style="color: #DD0000">"demo"</span><span style="color: #007700">)-&gt;</span><span style="color: #0000BB">getCollectionNames</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$collections</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

   <div class="example-contents"><p>以上例程的输出类似于：</p></div>
   <div class="example-contents screen">
<div class="cdata"><pre>
array(2) {
  [0]=&gt;
  string(9) &quot;addresses&quot;
  [1]=&gt;
  string(5) &quot;users&quot;
}
</pre></div>
   </div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-mongodb.getcollectionnames-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="mongodb.listcollections.html" class="function" rel="rdfs-seeAlso">MongoDB::listCollections()</a> - Gets an array of all MongoCollections for this database</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mongodb.get.html">MongoDB::__get</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mongodb.getdbref.html">MongoDB::getDBRef</a></div>
 <div class="up"><a href="class.mongodb.html">MongoDB</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
